package com.ek.kademlia.protocol.impl;

import java.io.Serializable;
import java.net.SocketAddress;

import com.ek.kademlia.protocol.FindNodeResponse;
import com.ek.kademlia.protocol.FindValueResponse;

public class DefaultFindValueResponse implements FindValueResponse {

    private static final long serialVersionUID = 20826560851526896L;

    private byte[] messageID;
    private byte[] nodeID;
    private Serializable value;
    private SocketAddress socketAddress;

    public byte[] getMessageID() {
        return messageID;
    }

    public void setMessageID(byte[] id) {
        this.messageID = id;
    }

    public String getMessageClass() {
        return FindNodeResponse.class.getCanonicalName();
    }

    public void setNodeID(byte[] nodeID) {
        this.nodeID = nodeID;
    }

    public byte[] getNodeID() {
        return nodeID;
    }

    public SocketAddress getSocketAddress() {
        return socketAddress;
    }

    public void setSocketAddress(SocketAddress serviceAddress) {
        this.socketAddress = serviceAddress;

    }

    public void setValue(Serializable value) {
        this.value = value;
    }

    public Serializable getValue() {
        return value;
    }
    
    @Override
    public String toString() {
        return new StringBuilder().
        append("DefaultFindValueResponse {\n").
        append("value:" + value + "\n").
        append("}\n").
        toString();
    }

}
